<?php
ini_set ( 'session.cookie_lifetime', '36000' );
ini_set ( "session.gc_maxlifetime", '36000' );
session_start ();
if (empty ( $_SESSION ['login'] )) {
	header ( 'Location:index.php' );
	exit ();
}
?>
<?php

header ( "Cache-Control: no-store,no-cache, must-revalidate" );
header ( "Content-Type: text/html; charset=utf-8" );
require_once $_SERVER ['DOCUMENT_ROOT'] . "/bib/class/php/mysql_class.php";
$mysql_bib = new mysql_class ( 'vksm.net.mysql', 'vksm_net', 'egDYxATy', 'vksm_net' );
// $mysql_bib = new mysql_class ( 'localhost', 'root', '', 'regi' );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Gallery</title>
</head>

<body>
<?php
echo '<h1>Willkommen ' . $_SESSION ['login'] . '</h1>';
echo '<a href="abmeldung.php">Abmelden</a>' . '<br/><br/>';
$donnees = $mysql_bib->query ( "SELECT vorname FROM user WHERE pseudo = '" . $_SESSION ['login'] . "'" );
$donnees2 = $mysql_bib->query ( "SELECT * FROM videos ORDER BY dayoftraining DESC" );
$last_regi = $mysql_bib->query ( "SELECT lastRegistration FROM user WHERE pseudo = '" . $_SESSION ['login'] . "'" );

foreach ( $last_regi as $elt ) {
	$regi = $elt ["lastRegistration"];
}
echo 'Letzte Anmeldung: ' . $regi . '<br/><br/>';

$choreo = "Choreograf";
$freestyle = "Freestyle";
foreach ( $donnees2 as $elt ) {
	$name = $elt ["name"];
	$url = $elt ["url"];
	$dayoftraining = $elt ["dayoftraining"];
	
	echo ($dayoftraining == '' ? '&nbsp;' : '<b><u>Am Dienstag, den ' . $dayoftraining) . '</u></b><br /><br />';
	echo ($dayoftraining == '' ? '<b>' . $name . ' - ' . $freestyle : $name . ' - ' . $choreo) . '</b><br />';
	echo "<video width='600' height='340'controls><source src='video/$url" . "' type='video/mp4'></video><br/><br/><br/>";
}
?>
<br />
	<p>
	<b>Musik zum downloaden</b> : <a
		href="http://vksm.net/vksm_tanz/audio/orchestre Patengue.mp3"
		download="orchestre_Patengue.mp3">orchestre Patengue</a> <br />
	</p>
	<a href="abmeldung.php">Abmelden</a> <br />

</body>
</html>
